/**
 * Created by Lin on 2018-1-6.
 */
const express=require('express');
const router=express.Router();
const testToken=require('./testToken');

router.post('/delIncome',function (req,res) {
  const Income = global.dbHandel.getModel('income');
  let token=req.body.token;
  let id=req.body._id;
  let result=testToken.testToken(token);
  if(result.success==true) {
    Income.remove({_id:id},function (error,docs) {
      if(error){
        res.send(500,{error:'删除失败'});
      }else {
        res.send(200,{success:'删除成功'})
      }
    })
  }else {
    res.send(500,{error:result});
  }
})

module.exports=router;
